package valatile;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author Aug28-tlsjn
 * @date 2021-04-11 Sunday 10:50
 */
public class ThreadUtils {
  public static ExecutorService getExecutorService(int corePoolSize, int maxPoolSize, long ttl, int queueSize) {
    return new ThreadPoolExecutor(corePoolSize, maxPoolSize, ttl, TimeUnit.SECONDS, new ArrayBlockingQueue<>(queueSize), new ThreadPoolExecutor.AbortPolicy());
  }
}
